SuperStrict

'@build	bmx makeapp (-x [to run after build]) -r -o (-a [if not quick build]) "php.test2.exe" "php.test2.bmx"
'@note	Or just use MaxIDE, MaxIDE Community Edition, MaxIDE X, BLide, or any other IDE you want.

Framework BRL.Retro

Include "./library/php.inc.bmx";

Print "php Test 2~n";

'/// Base conversion Tests
Print bindec( "110011" );
Print bindec( "000110011" );
Print bindec( "111" );

Print decbin( 51 );
Print decbin( 7 );

Print dechex( 10 ); ' Test failed added to @todo
Print " hexdec: " + hexdec( "FGE" )

' Misc Functions Tests
If ( empty( "" ) )
	Print "~nString is empty";
End If

Print rtrim( "~nWhy do you hate spaces!?    ~r    ~0 "  + Chr(11) + "       ~n    " ) + "<-- No spaces!";
Print rtrim( "Spaces aren't the only thing! -->ABCDEF", "ABCDEF" );
Print rtrim( "String that doesn't need to be trimmed and doesn't loose any text" );

Print "~nrtrim, ltrim, and trim/btrim - Examples";

Local text:String, binary:String, hello:String;
text = "~t~tThese are a few words :) ...  ";
binary = Chr(9) + "Example string" + Chr(10);
hello = "Hello World";

Print "~q" + text + "~q";
Print "~q" + binary + "~q";
Print "~q" + hello + "~q";
Print "~q" + rtrim( text ) + "~q";
Print "~q" + rtrim( text, " ~t." ) + "~q";
Print "~q" + rtrim( hello, "Hdle" ) + "~q";
'Print rtrim( binary ); ' Can't be replicated at the moment
Print "~q" + ltrim( text ) + "~q";
Print "~q" + ltrim( text, " ~t." ) + "~q";
Print "~q" + ltrim( hello, "Hdle" ) + "~q";
'Print ltrim( binary ); ' Can't be replicated at the moment
Print "~q" + btrim( text ) + "~q";
Print "~q" + btrim( text, " ~t." ) + "~q";
Print "~q" + btrim( hello, "Hdle" ) + "~q";
'Print btrim( binary ); ' Can't be replicated at the moment
Print "~q" + php.strings.trim( text ) + "~q";
Print "~q" + php.strings.trim( text, " ~t." ) + "~q";
Print "~q" + php.strings.trim( hello, "Hdle" ) + "~q";

Print "~nString Split Tests~n";

Local tString:String[] = str_split( "Hello World", 2 );
For Local cnt:Int = 0 To tString.Length - 1
	Print cnt + ": " + tString[cnt];
Next

tString = str_split( "Hello World", 3 );
For Local cnt:Int = 0 To tString.Length - 1
	Print cnt + ": " + tString[cnt];
Next

tString = str_split( "Hello World", 4 );
For Local cnt:Int = 0 To tString.Length - 1
	Print cnt + ": " + tString[cnt];
Next

tString = str_split( "Hello World", 5 );
For Local cnt:Int = 0 To tString.Length - 1
	Print cnt + ": " + tString[cnt];
Next